package com.hjqjl.whdemo.widget.glowworm;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class GlowwormManager {
    private int glowwormAmount;//萤火虫数量
    private Glowworm[] Glowworm;
    private boolean isGlowworm = false;

    public GlowwormManager(Bitmap bmpGlowworm, int xingkongBgFlag) {
        if (xingkongBgFlag == 1 || xingkongBgFlag == 2 || xingkongBgFlag == 5) {
            isGlowworm = true;
        } else {
            isGlowworm = false;
        }
        if (isGlowworm == true) {
            glowwormAmount = 20;
            Glowworm = new Glowworm[glowwormAmount];
            for (int i = 0; i < Glowworm.length; i++) {
                Glowworm[i] = new Glowworm(bmpGlowworm);
            }
        }
    }

    public void drawGlowworm(Canvas canvas) {
        if (isGlowworm == true) {
            for (int i = 0; i < Glowworm.length; i++) {
                Glowworm[i].drawSelf(canvas);
                Glowworm[i].logicBabysbreath();
            }
        }
    }
}